//
//  MYAboutViewController.m
//  投融保
//
//  Created by 523 on 13-12-19.
//  Copyright (c) 2013年 木叶科技. All rights reserved.
//

#import "MYAboutViewController.h"

@interface MYAboutViewController ()

@end

@implementation MYAboutViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    SETBACKGROUND
    
    [self initView];
    
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)initView
{
    Y=0;
    if (IOS_VERSION>=7) {
        Y=20;
    }
    
    //导航视图
    UIView *titleView=[[UIView alloc] initWithFrame:CGRectMake(0, Y, SCREEN_WIDTH, 105)];
    [titleView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"titile_bg"]]];
    [self.view addSubview:titleView];
    
    UILabel *lblTitle=[[UILabel alloc] initWithFrame:CGRectMake(250, 0, 268, 105)];
    [lblTitle setText:@"关于我们"];
    [lblTitle setTextColor:[UIColor whiteColor]];
    [lblTitle setFont:[UIFont boldSystemFontOfSize:40]];
    [lblTitle setBackgroundColor:[UIColor clearColor]];
    lblTitle.textAlignment=NSTextAlignmentCenter;
    [titleView addSubview:lblTitle];
    
    //反悔按钮
    UIButton *btnReturn=[UIButton new];
    [btnReturn setFrame:CGRectMake(0, 0, 105, 105)];
    [btnReturn setImage:[UIImage imageNamed:@"return_icon"] forState:UIControlStateNormal];
    [btnReturn addTarget:self action:@selector(btnReturnClick) forControlEvents:UIControlEventTouchUpInside];
    [titleView addSubview: btnReturn];
    
    //关于说明
    NSString *str=@"关悦（1979年3月6日— ），满族，中国内地影视明星，北京电影学院2000级表演系毕业，现为（2012年）北京电影学院教师。曾主演《神探狄仁杰3》等多部影视剧和舞台剧。其丈夫是影视演员佟大为，两人生有一女。";
    CGSize aboutInfoSize=[str sizeWithFont:[UIFont systemFontOfSize:33] constrainedToSize:CGSizeMake(728, 400) lineBreakMode:NSLineBreakByCharWrapping];
    NSLog(@"%f,%f",aboutInfoSize.width,aboutInfoSize.height);
    UITextView *txtAboutInfo=[[UITextView alloc] initWithFrame:CGRectMake(20, Y+145, aboutInfoSize.width,aboutInfoSize.height+10)];
    txtAboutInfo.font=[UIFont systemFontOfSize:33];
    txtAboutInfo.text=str;
    txtAboutInfo.textColor=[UIColor lightGrayColor];
    [txtAboutInfo setBackgroundColor:[UIColor clearColor]];
    txtAboutInfo.userInteractionEnabled=NO;
    [self.view addSubview:txtAboutInfo];
    
    NSArray *arrWebsite=[[NSArray alloc] initWithObjects:@"电子邮件：",@"ahsdfla@gmail.com",@"新浪微博：",@"http://weibo.com/dafd",@"官方网站",@"www.ashdkal.com", nil];
    
    for (int i=0; i<6; i++) {
        UILabel *lblWebsite=[UILabel new];
        [lblWebsite setFrame:CGRectMake(20, (aboutInfoSize.height+165+Y)+i*40, 600, 40)];
//        [lblWebsite setTag:(11000+i)];
        if (i%2==0) {
            lblWebsite.textColor=[UIColor darkGrayColor];
        }else{
            lblWebsite.textColor=UIColorFromRGB(0xcbfe00);
        }
        lblWebsite.text=[arrWebsite objectAtIndex:i];
        lblWebsite.font=[UIFont systemFontOfSize:33];
        lblWebsite.backgroundColor=[UIColor clearColor];
        [self.view addSubview:lblWebsite];
        NSLog(@"%f",lblWebsite.frame.origin.y);
    }
    //版本信息
    NSString *strVersion=@"1.2.3";
    
    UILabel *lblVersion=[[UILabel alloc] initWithFrame:CGRectMake(400,650, 300, 40)];
    lblVersion.text=[NSString stringWithFormat:@"软件版本：%@",strVersion];
    lblVersion.textColor=[UIColor darkGrayColor];
    lblVersion.font =[UIFont boldSystemFontOfSize:40];
    lblVersion.textAlignment=NSTextAlignmentRight;
    lblVersion.backgroundColor=[UIColor clearColor];
    [self.view addSubview:lblVersion];
    
}

//返回前页按钮方法
- (void)btnReturnClick
{
    [self dismissViewControllerAnimated:YES completion:nil];
}


#pragma mark-   -----------状态栏底色------
- (UIStatusBarStyle)preferredStatusBarStyle
{
    [self.view setBackgroundColor:[UIColor blackColor]];
    return UIStatusBarStyleLightContent;
}
- (BOOL)prefersStatusBarHidden
{
    return NO;
}

@end
